package com.gxa.controller.shezhicontroller;

import com.gxa.common.R;
import com.gxa.pojo.ZhangHu;
import com.gxa.pojo.ZhangHuSheZhi;
import com.gxa.pojo.ZhangHuType;
import com.gxa.service.shezhiservice.ZhangHuService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author weishen
 */
@RestController
@RequestMapping("/ZhangHu")
@Api(value = "账户管理" , tags = "账户数据接口API")
@RequiresPermissions("账户管理")
public class ZhangHuController {

    @Autowired(required = false)
    public R r;

    @Autowired
    ZhangHuService zhangHuService;
    @GetMapping("/selectAllZhangHuForPage")
    @ApiOperation(value = "查询所有账户信息接口",notes = "提供页码和每页显示数",httpMethod = "get",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "size",value = "每页显示数",required = true,dataType = "int",paramType = "query"),

    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectAllZhangHuForPage(@RequestParam int page,@RequestParam int size)
    {
        return zhangHuService.selectAllZhangHuForPage(page, size);
    }

    @PostMapping("/updateZhangHuById")
    @ApiOperation(value="修改账户信息接口",notes = "提供账户信息",httpMethod = "post",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R updateZhangHuById(@RequestBody ZhangHuSheZhi zhanghu)
    {
        return zhangHuService.updateZhangHuById(zhanghu);
    }
    @PostMapping("/insertZhangHu")
    @ApiOperation(value="新增账户接口",notes="提供账户信息",httpMethod = "post",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R insertZhangHu(@RequestBody ZhangHuSheZhi zhangHu)
    {
        return zhangHuService.insertZhangHu(zhangHu);
    }

    @PostMapping("/deleteZhangHuById")
    @ApiOperation(value = "删除账户接口",notes = "提供账户id",httpMethod = "get",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R deleteZhangHuById(@RequestParam ArrayList<Integer> id)
    {
        return zhangHuService.deleteZhangHuById(id);
    }

}
